Skip to content

Frontier state reads as structure, not a wall of collapsed JSON - #108

Merged
Barneyjm merged 1 commit into
mainfrom
claude/frontier-state-render
Aug 1, 2026
Merged

Frontier state reads as structure, not a wall of collapsed JSON#108
Barneyjm merged 1 commit into
mainfrom
claude/frontier-state-render

Conversation

@Barneyjm

@Barneyjm Barneyjm commented Aug 1, 2026

Copy link
Copy Markdown
Owner

Follow-up to #107 (this commit was pushed to that branch just after it merged, so it needs its own PR).

The compacted working set was rendered as JSON.stringify(state, null, 1) dropped straight into a <div>. The indent argument produced newlines — and HTML collapsed every one of them. The result was a single unbroken slab of monospace with the braces and quotes still in it; on a phone, most of a screen of it before you reach anything else.

Before (real firstproof-c4 state, as shipped):

{ "phase2": "PHASE-2 READY (second pass). Fixed slim_sim.py is MERGED: repo Barneyjm/givework-contrib, sha 43b5d6d3f… entrypoint slim/slim_sim.py — it reads the platform stdin JSON ({n, c, num_samples, M, seed}; unknown keys ignored; argv fallback). NEXT: propose a decomposition…", "attempt7_note": "Attempt 7 produced…", "timeout_salvage": { "source": "stream", "partial": "Looking at…", "task_id": "c0fbb5df…", "elapsed_ms": 600024 } }

After — keys become labels, values become prose:

CURRENT FRONTIER                              [Raw JSON]

PHASE2
  PHASE-2 READY (second pass). Fixed slim_sim.py is MERGED: repo
  Barneyjm/givework-contrib, sha 43b5d6d3f168…, entrypoint
  slim/slim_sim.py — it reads the platform stdin JSON…

ATTEMPT7 NOTE
  Attempt 7 produced a full decomposition + simulation code but
  mis-formatted the output (prose + fences)…

TIMEOUT SALVAGE
  │ SOURCE
  │   stream
  │ PARTIAL
  │   Looking at the previous timeout attempts and the nature of
  │   this task (requires executing code for n up to 10^6)…
  │ TASK ID
  │   c0fbb5df-61c5-42e7-8605-0978cfde5c5c
  │ ELAPSED MS
  │   600024

Nested objects indent behind a rail and their keys render smaller, so hierarchy survives more than one level. Long strings — the agent-written prose that is most of any frontier — get the reading face; short scalars (ids, counts, flags) keep the terminal one. Arrays of scalars join onto one line instead of becoming a column of one-word rows.

The keys are unknowable by design (an agent writes this via state_update), so the renderer is generic rather than keyed to any particular shape, with a depth bound that falls back to raw JSON rather than recursing forever.

A Raw JSON toggle keeps the exact payload one click away — in a <pre> this time, so its newlines survive.

Testing

Rendered the real firstproof-c4 state plus eleven edge shapes: nested objects, arrays of scalars and of objects, empty object, empty array, null, booleans, numbers, unicode, embedded newlines, >5-deep nesting, and an injection attempt — which escapes correctly (&lt;img src=x onerror=…&gt;).

Site-only, so no version bump: the CLI bundle is untouched and this ships via the Deploy workflow on merge.

⚠️ Not visually confirmed in a browser — no extension available and no headless DOM in the project. The renderer was exercised directly by extracting it from the page and running it in Node.

🤖 Generated with Claude Code

https://claude.ai/code/session_01QQgFEPRY4W74D4eqawQ4A6

The compacted working set was rendered as JSON.stringify(state, null, 1)
dropped straight into a <div>. The indentation produced newlines, HTML
collapsed every one of them, and the result was a single unbroken slab of
monospace — on a phone, most of a screen of it, braces and quotes and all.

Now the structure is rendered: keys become labels, values become prose.
Nested objects indent behind a rail and their keys read smaller, so hierarchy
survives. Long strings (the agent-written prose that makes up most of a
frontier) get the reading face; short scalars — ids, counts, flags — keep the
terminal one. Arrays of scalars join onto one line rather than becoming a
column of one-word rows.

The keys are unknowable by design — an agent writes this via state_update —
so the renderer is generic rather than keyed to any particular shape, with a
depth bound that falls back to raw JSON rather than recursing forever.

A "Raw JSON" toggle keeps the exact payload one click away, in a <pre> so its
newlines actually survive this time.

Checked against the real firstproof-c4 state and eleven edge shapes: nested
objects, arrays of scalars and of objects, empty object/array, null,
booleans, numbers, unicode, embedded newlines, >5-deep nesting, and an
injection attempt (escaped correctly).

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01QQgFEPRY4W74D4eqawQ4A6
@gemini-code-assist

Copy link
Copy Markdown

Caution

The consumer version of Gemini Code Assist on GitHub has been sunset. All code review activity has officially ceased.

@Barneyjm
Barneyjm merged commit c5e8670 into main Aug 1, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant